<!-- http://www.imooc.com/wiki/uniapp/databinding.html -->
<template>
	<view class='content'>
		<!-- 普通选择器 -->
		<picker @change="chooseName" :value="index" :range="names">
			<view v-if="index == 0">
				--- {{names[index]}} ---
			</view>
			<view v-else-if="index == 1">
				*** {{names[index]}} ***
			</view>
			<view v-else>
				我的名字是：{{names[index]}}
			</view>
		</picker>
	</view>
</template>

<script>
export default {
  data () {
    return {
      index: 0,
      names: ['请选择!', '小慕课', '大慕课', '老慕课']
    }
  },
  onLoad(){
	  console.log('~~~', this.index);
  },
  methods: {
    chooseName (e) {
      console.log("当前选择名字的索引是：",e.detail.value);
	  this.index = e.detail.value;
	  console.log('--- index:', this.index);
    }
  }
}
</script>
